package com.swallow.auth.domain.dept.service.impl;

import com.swallow.auth.domain.dept.model.DeptRoot;
import com.swallow.auth.domain.dept.model.entity.DeptEntity;
import com.swallow.auth.domain.dept.service.IDeptDomainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author: 18310740596@163.com
 * @date: 2024-05-20 21:54:43
 * @version: v1.0
 * @describe: class responsibility
 */
@Slf4j
@Service
public class DeptDomainServiceImpl implements IDeptDomainService {

    @Override
    public String createDept(DeptRoot deptRoot) {
        DeptEntity deptEntity = deptRoot.getDeptEntity();
        // 重复性校验
        deptEntity.nameRepeatCheck();
        // 部门创建
        deptEntity.create();

        return deptEntity.getDeptNo();
    }


    @Override
    public void deleteDept(DeptRoot deptRoot) {
        String deptNo = deptRoot.getDeptNo();

        DeptEntity entity = DeptEntity.builder()
                                      .deptNo(deptNo)
                                      .build();

    }
}
